<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'estate.label', default: 'estate')}"/>
    <title>分析报告</title>
    <style>
    .table>tbody>tr>td{
        vertical-align: middle;
    }
    </style>
</head>

<body class="fixed-navbar fixed-sidebar">
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>CINDATA PLS</li>
                    <li class="active">
                        <span>分析报告</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                %{--<a href="index" class="pe-7s-back fa-2x">&nbsp;&nbsp;</a>--}%
                分析报告
            </h2>
        </div>
    </div>
</div>

<div class="content animate-panel">

    <div class="row">
        <g:form method="POST" action="report" class="form-horizontal" role="form">
            <div class="hpanel">
                <div class="panel-heading">
                    <div class="panel-tools">
                    </div>
                </div>

                <div class="panel-body seach-group" id="bug1">
                    <strong style="color: #62cb31;">评估时间：<g:formatDate date="${estateImportBatch?.modifiedDate}" format="yyyy-MM-dd"></g:formatDate> 评估批次名：${estateImportBatch?.batchNumber ?: '-'}</strong>
                </div>
            </div>
        </g:form>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <button class="btn  btn-warning2 btn-xs " type="button"><i class="fa fa-print"></i> 打印报告</button>
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                押品分析
            </div>
            <div class="panel-body" style="border-bottom: none; padding-bottom: 0">
                <div>
                    <h4 style="font-size: 13px;">小区级押品分布</h4>
                        <span>本批次复估押品<strong style="color: #FF0000;">${counts ?: 0}</strong> 件，其中高风险 <strong style="color: #FF0000;">${highRiskCounts ?: 0}</strong> 件，占本批次的 <strong style="color: #FF0000;">${highRiskCounts / counts * 100}%</strong>，其中跌破 <strong style="color: #FF0000;">${highRiskDownCounts ?: 0}</strong> 件，占 <strong style="color: #FF0000;">${highRiskDownCounts / counts * 100}%</strong>，本批次未发生风险有<strong style="color: #FF0000;">${(counts - highRiskCounts) ?: 0}</strong>件，占<strong style="color: #FF0000;">${(counts - highRiskCounts) / counts * 100}%</strong>，其中净值<strong style="color: #FF0000;">${netValue ?: 0}</strong>件，占<strong style="color: #FF0000;">${netValue / counts * 100}%</strong>。</span>
                    <div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="hpanel" style="">
                    <div class="col-md-12">
                        <div class="hpanel">
                            <h4 class="showhide" style="padding: 0;margin: 0;margin-right: 0px;padding-left: 20px;background: #fff;padding-top: 10px;padding-bottom: 10px;font-size: 13px;cursor: pointer;color: #62cb31;font-weight: bold;border: 1px solid #eaeaea;border-top: none;border-bottom: none;">top20价值波动押品
                                <div class="panel-tools pull-right">
                                    <a class=""><i class="fa fa-chevron-down" style="font-size: 13px; margin-right: 9px;"></i></a>
                                </div>
                            </h4>

                            <div class="panel-body" style="border:none; display: none;border-left: 1px solid #e5e5e5;border-right: 1px solid #e5e5e5;">
                                <div class="table-responsive">
                                    <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="esateTable">
                                        <thead>
                                        <tr>
                                            <g:sortableColumn property="city" title="押品编号" class="col-md-1 text-center" params="${params}"/>
                                            <g:sortableColumn property="district" title="城市" class="col-md-1 text-center" params="${params}"/>
                                            <g:sortableColumn property="fullName" title="行政区" class=" col-md-1 text-center" params="${params}"/>
                                            <g:sortableColumn property="counts" title="小区名称" class=" col-md-1 text-center" params="${params}"/>
                                            <g:sortableColumn property="counts" title="房屋坐落" class=" col-md-1 text-center" params="${params}"/>
                                            <g:sortableColumn property="counts" title="第一次估值（元）" class=" col-md-1 text-center" params="${params}"/>
                                            <g:sortableColumn property="counts" title="当前估值（元）" class=" col-md-1 text-center" params="${params}"/>
                                            <g:sortableColumn property="counts" title="价值波动率" class=" col-md-1 text-center" params="${params}"/>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <g:each in="${estateList}">
                                            <tr>
                                                <td class="text-center">${it?.externalId}</td>
                                                <td class="text-center">${it?.city?.name}</td>
                                                <td class="text-center">${it?.district?.name}</td>
                                                <td class="text-center">${it?.communityName}</td>
                                                <td class="text-center">${it?.sourceAddress}</td>
                                                <td class="text-center">${it?.firstEvaluatePrice}</td>
                                                <td class="text-center">${it?.latestEvaluatePrice}</td>
                                                <g:if test="${it?.priceFluctuationsRatio && it?.priceFluctuationsRatio > 0}">
                                                    <td class="text-center">上升 ${it?.priceFluctuationsRatio * 100}%</td>
                                                </g:if>
                                                <g:elseif test="${it?.priceFluctuationsRatio && it?.priceFluctuationsRatio < 0}">
                                                    <td class="text-center">下降 ${-it?.priceFluctuationsRatio * 100}%</td>
                                                </g:elseif>
                                                <g:else>
                                                    <td class="text-center">-</td>
                                                </g:else>
                                            </td>
                                        </tr>
                                        </g:each>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                贷款分析
            </div>
            <div class="panel-body">
                <div>
                    <h4 style="font-size: 13px;">押品剩余还款期分布</h4>
                    <span>本批次按剩余还款期限统计押品数量，剩余还款期限在 <strong style="color: #FF0000;">${remainTimeList[0].remainTime}</strong> 的押品数据最多，包括 <strong style="color: #FF0000;">${remainTimeList[0].counts}</strong> 件押品，占总量押品的 <strong style="color: #FF0000;">${remainTimeList[0].counts / counts * 100}%</strong>；其次是剩余还款期限在 <strong style="color: #FF0000;">${remainTimeList[1].remainTime}</strong> 年的押品，包括 <strong style="color: #FF0000;">${remainTimeList[1].counts}</strong> 件押品，占总量押品的<strong style="color: #FF0000;">${remainTimeList[1].counts / counts * 100}%</strong>。</span>
                    <div class="table-responsive">
                        <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="">
                            <thead>
                            <tr>
                                <g:sortableColumn property="city" title="剩余还款期" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="district" title="押品数量" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="counts" title="占比" class=" col-md-1 text-center" params="${params}"/>
                            </tr>
                            </thead>
                            <tbody>
                            <g:each in="${remainTimeList}">
                                <tr>
                                    <td class="text-center">${it?.remaintime}</td>
                                <td class="text-center">${it?.counts}</td>
                                <td class="text-center"><g:if test="${estateCounts != 0}"><g:formatNumber number="${it?.counts/counts * 100}" minFractionDigits="2" maxFractionDigits="2"/></g:if><g:else>0.00</g:else>%</td>
                                </td>
                            </tr>
                            </g:each>
                            </tbody>
                        </table>
                    </div>
                </div>
                <hr/>
                <div>
                    <h4 style="font-size: 13px;">逾期押品情况预警</h4>
                    <span>本批次有 <strong style="color: #FF0000;">${overdueCounts}</strong> 件押品，超过还款期限，仍未偿还完，针对这部分押品，银行应该特别重视，以下是逾期押品分布情况：</span>
                    <div class="table-responsive">
                        <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="">
                            <thead>
                            <tr>
                                <g:sortableColumn property="city" title="小区名称" class="col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="district" title="逾期押品数量" class="col-md-1 text-center" params="${params}"/>
                                <!-- <g:sortableColumn property="fullName" title="小区基准价（当前）" class=" col-md-1 text-center" params="${params}"/> -->
                                <g:sortableColumn property="counts" title="押品编号" class=" col-md-1 text-center" params="${params}"/>
                                <g:sortableColumn property="counts" title="受理网点" class=" col-md-1 text-center" params="${params}"/>
                            </tr>
                            </thead>
                            <tbody>
                            <g:each in="${overdueList}">
                                <tr>
                                    <td class="text-center">${it?.communityName}</td>
                                    <td class="text-center">${it?.overnumbers}</td>
                                    <!-- <td class="text-center">${it?.standardPrice}</td> -->
                                    <td class="text-center">${it?.externalId}</td>
                                    <td class="text-center">${it?.accountName}</td>
                                </td>
                            </tr>
                            </g:each>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>

<g:javascript>
    $("#toPrint").click(function(){
        var city =  $("#city").val();
        window.open("/analyze/report?city="+city+"&gtype=999",'addFileWindow','toolbar=no,location=no,resizable=no, height=768, width=1000,,scrollbars=yes ,left=380,top=100');
    })
</g:javascript>

<asset:javascript src="echarts/echarts-all-3.js" />
<asset:javascript src="main/report.js" />
</body>
</html>
